package ee.ut.aa.neuraltic.main;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;

import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;

import ee.ut.aa.neuraltic.genetic.Brain;
import ee.ut.aa.neuraltic.logic.GeneticTrainer;
import ee.ut.aa.neuraltic.model.NeuralPlayer;

public class Main {

	private static Logger log = Logger.getLogger( Main.class );

	public static void main( String[] args ) throws FileNotFoundException, IOException {

		Properties logProperties = new Properties();

		// load our log4j properties / configuration file
		logProperties.load( new FileInputStream( "etc/log4j.properties" ) );
		PropertyConfigurator.configure( logProperties );

		log.info( "Hello world!" );

		log.info( "Starting training with following parameters:" );
		log.info( "population=" + Brain.POPULATION );
		log.info( "mutation=" + Brain.MUTATION );

		String resultval = "win=" + GeneticTrainer.WINVALUE;
		resultval += ";draw=" + GeneticTrainer.DRAWVALUE;
		resultval += ";loss=" + GeneticTrainer.LOSSVALUE;

		log.info( resultval );

		log.info( "minmax depth=" + NeuralPlayer.DEPTH );

		GeneticTrainer trainer = new GeneticTrainer();

		trainer.startTraining( Integer.MAX_VALUE );
		//trainer.startTraining( 1 );

	}
}
